package com.library;

public class UserInit {
    public static void initName() {
        // 在这里要获取UserInfo.getUserName()
        try {
            Class<IName> iName = (Class<IName>) Class.forName("com.reflectdemo.INameImpl");
            IName name = iName.newInstance();
            System.out.println("姓名为: " + name.getName());
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (InstantiationException e) {
            e.printStackTrace();
        }
    }
}
